<template>
	<div>
	   <Card class="content-card">
	  <Tabs :animated="false">
	    <ButtonGroup slot="extra">
			
	    </ButtonGroup>
	    <TabPane label="机手列表" name="factory">
	            <table-view ref="tableView" :tableCol='tableCol' :params='params' :requestUrl='requestUrl'></table-view>
	    </TabPane>
	  </Tabs>
	</Card>
</div>
</template>

<script>
	import tableView from '../../components/table'
	import {formatDate} from '../utils/time.js'
	export default {
	    components:{
	        tableView
	    },
	    data(){
	        return {
	            requestUrl:'/machinist/beg/query/list',
				  timeImitList:{
				   0:'短期',1:'长期',2:'均可'
				},
	            tableCol:[
	               {
	                   title:'序号',
	                   type:'index',
	                   width:70
	               },{
	                   title:'称呼',
	                   minWidth:100,
					  render:(h,params)=>{
						  return h('div',params.row.user.realName);
					  }
					  
	               },{
	                   title:'工期',
	                   minWidth:80,
					   render:(h,params)=>{
						  return h('div',this.timeImitList[params.row.timeImit]);
					  }
	               },{
	                   title:'短期价格',
	                   minWidth:80,
					    render:(h,params)=>{
							return h('div',params.row.shortTerm + "元");
					   }
	               },{
	                   title:'长期价格',
	                   minWidth:80,
					    render:(h,params)=>{
							return h('div',params.row.longTime + "元");
					   }
	               },{
	                   title:'距离范围',
	                   minWidth:80,
					   key:'distanceRange'
	               },{
	                   title:'地址',
	                   minWidth:150,
					    render:(h,params)=>{
					       return h('div',params.row.provinceName+params.row.cityName+params.row.areaName+params.row.address)
					   }
	               },{
	                   title:'截止日期',
	                   minWidth:80,
	                   key:'effectiveTime',
					   render:(h,params)=>{
						  return h('div',formatDate(new Date(params.row.effectiveTime),'yyyy-MM-dd hh:mm'))
					  }
	               },{
	                   title:'发布时间',
	                   minWidth:80,
	                   key:'createTime',
					   render:(h,params)=>{
						  return h('div',formatDate(new Date(params.row.createTime),'yyyy-MM-dd hh:mm'))
					  }
	               },{
	                   title:'操作',
	                   key:'action',
	                   minWidth:200,
	                   render:(h,params)=>{
	                       return h('div',[
	                           h('Button',{
	                               props:{
	                                   type:'error',
	                                   size:'small'
	                               },
	                               style:{
	                                   marginLeft:'10px'
	                               },
	                               on:{
	                                  click:()=>{
	                                       this.$Modal.confirm({
	                                       	title: '删除？',
	                                       	content: '确定要删除吗？删除不可恢复',
	                                       	onOk: () => {
	                                       		this.$http.post('machinist/beg/delete', {
	                                       			id: params.row.id
	                                       		}).then(res => {
	                                       			if (res.status == 200) {
	                                       				this.$refs['tableView'].getData()
	                                       				this.$Notice.warning({
	                                       					title: '删除成功'
	                                       
	                                       				});
	                                       			}
	                                       		})
	                                       	}
	                                       })
	                                  }
	                               }
	                           },'删除')
	                       ])
	                   }
	               }
	
	            ],
	            params:{
	                pageNo:1,
	                pageSize:10
	            },
	            modalType:''
	        }
	    },
		mounted() {
		   
		},
	    methods:{
			addFactory(){
			    this.modalType = 'add'
			    this.$refs['factoryOpe'].show()
			},
	        refreshData(){
	            this.$refs['tableView'].getData()
	        },
	        operationDone(){
	            this.$refs['tableView'].getData()
	        }
	    }
	}
	
</script>

<style>
</style>

